export { }

document.body.addEventListener('click', e => {
	// 类型断言
	const tar = e.target as HTMLElement;

	if (tar.className === 'add') {
		console.log('+++++')
	}


	tar.classList.add('active')
})


const el = document.getElementById('root');
// 排除可能性为假的情况

el!.classList.add('active')
el?.classList.add('active')

if (el !== null) {
	el.classList.add('active')
}

let qweqwe: undefined | number | string | boolean = 1

qweqwe = true

if (typeof qweqwe === 'undefined') {

	console.log(qweqwe)

} else if (typeof qweqwe === 'number') {

	console.log(qweqwe)

}

else if (typeof qweqwe === 'boolean') {
	console.log(qweqwe)
}


interface O {
	o?: {
		sayName: Function
	}
}


const o11: O = {
	o: {
		sayName() {
			console.log('哈哈')
		}
	}
}

o11.o?.sayName()

if (o11.o) {
	o11.o.sayName()
}